|
ErrorsCollection

|

Synthesised documentation from language/operators language/operators

From language/operators

See Original text in context

Flattens objects of type Capture, Pair, List, Map and Hash into an argument list.

sub slurpee|args ){
    say args.raku
};
slurpee( <a b c d>{ => 3 }'e' => 'f' => 33 )
# OUTPUT: «\(("a", "b", "c", "d"), {:e(3)}, :e(:f(33)))␤»

Please see the Signature page, specially the section on Captures for more information on the subject.

Outside of argument lists, it returns a Slip, which makes it flatten into the outer list. Inside argument list Positionals are turned into positional arguments and Associatives are turned into named arguments.

From language/operators

See Original text in context

multi sub infix:<|>($a$b --> Junction:Dis assoc<list>

Creates an any Junction from its arguments.

my $three-letters = /<[a b c]>/ | /<[i j k]>/ | /<[x y z]>/;
say $three-letters.raku# OUTPUT: «any(/<[a b c]>/, /<[i j k]>/, /<[x y z]>/)␤» 
say 'b' ~~ $three-letters# OUTPUT: «True␤»

This first creates an any Junction of three regular expressions (every one of them matching any of 3 letters), and then uses smartmatching to check whether the letter b matches any of them, resulting in a positive match. See also Junction for more details.